/*
   Project AwesOmeScript
   Copyright 2010 Domenico Gentner

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef VIEWBASE_HPP
#define VIEWBASE_HPP

#include "HtmlEdit.hpp"
#include "MyHtmlWindow.hpp"

// Lets keep all ids here, since this header is included into Mainframe.hpp
// and so we have all ids in all necessary files like notebookview.hpp and Splitview.hpp
enum eProjectIds
{
	idCLOSE = (wxID_HIGHEST + 1),
	idABOUT,
	idPAGE_SOURCE,
	idPAGE_HTML,
	idNOTEBOOK,
	idSPLITTER,
	idMENU_OPEN,
	idMENU_SAVE,
	idMENU_SAVE_AS,
	idMENU_EXPORT_SCRIPT,
	idMENU_RELOAD_HTML,
	idMENU_SHOW_STARTUP,
	idMENU_EXIT,
	idMENU_SETTINGS,
	idMENU_ABOUT,
	idMENU_SPLITVIEW,
	idMENU_NOTEBOOKVIEW,
	idMENU_SELECT_AODIR,
	idMENU_SELECT_HTML_COLOR,
	idMENU_NEW_PROJECT,
	idMENU_SHOW_PROJECT_PROPS,
	idMENU_ADD_HTML_BREAKLINE,
	idMENU_ADD_HTML_CENTERTEXT,
	idMENU_TOGGLE_WORDWRAP,
	idMENU_TOGGLE_LINENUMBERS,
	idMENU_SELECT_FONT,
	idMENU_CHECK_VERSION,
	idCURL,	
	idSETTINGS_RESET_TO_STANDARD,
	idMENU_SHOW_ICONBROWSER,
	idMENU_IMPORT_ICONS,
};





//////////////////////////////////////////////////////////////////////////
// Base class for the view.
// We can have 2, so we just need to swap pointers.
class IViewbase
{
public:
	explicit IViewbase(wxWindow* parent)
		: m_txtCtrl(NULL), m_htmlWindow(NULL)
	{}

	virtual ~IViewbase()
	{}

	void LoadHtmlPage(const wxString& page)
	{	
		m_htmlWindow->LoadPage(page);
	}

	void SetHtmlSource(const wxString& source)
	{
		m_htmlWindow->SetPage(source);
	}

	void SetSourceText(const wxString& source)
	{
		m_txtCtrl->Clear();
		m_txtCtrl->AppendText(source);
	}

	wxString GetSourceText()
	{
		return m_txtCtrl->GetValue();
	}

	wxHtmlWindow* GetHtmlWindow() { return m_htmlWindow; }
	HtmlEdit*	  GetTextControl(){ return m_txtCtrl;    }

protected:
	HtmlEdit*		m_txtCtrl;
	MyHtmlWindow*	m_htmlWindow;
};

#endif // VIEWBASE_HPP
